{template 'header'}
<ul class="nav nav-tabs">
    <li class="active"><a href="{php echo $this->createWeburl('task', array('op' => 'add'));}">添加任务</a></li>
</ul>
<form action="" method="post" class="form-horizontal" id="myform" role="form" enctype="multipart/form-data">

    <div class="form-group">
        <label class="col-xs-12 col-sm-3 col-md-1 control-label">标题:</label>
        <div class="col-sm-7 col-lg-8 col-md-8 col-xs-12">
            <input class="form-control" name="title" placeholder="标题" value="{$task['title']}" type="text">
        </div>
    </div>
    <div class="form-group">
        <label class="col-xs-12 col-sm-3 col-md-1 control-label">类型</label>
        <div class="col-sm-9 col-xs-12">
            <label class="radio-inline">
                <input type="radio" name="type" value="1" {if $task['type'] ==1 || $task['type'] == ''} checked {/if} /> 激励视频
            </label>
            <label class="radio-inline">
                <input type="radio" name="type" value="2" {if $task['type'] ==2} checked {/if} />试玩小程序
            </label>
        </div>
    </div>
    <div id="mode_one" {if $task['type'] !=2 } style="display: none" {/if}>
        <div class="form-group" >
            <label class="col-xs-12 col-sm-3 col-md-1 control-label">小程序appid:</label>
            <div class="col-sm-7 col-lg-8 col-md-8 col-xs-12">
                <input class="form-control" name="appid" placeholder="其他小程序appid" value="{$task['appid']}" type="text">
            </div>
        </div>

        <div class="form-group" id="path">
            <label class="col-xs-12 col-sm-3 col-md-1 control-label">路径</label>
            <div class="col-sm-7 col-lg-8 col-md-8 col-xs-12">
                <input class="form-control" name="path" placeholder="路径" value="{$task['path']}" type="text">
            </div>
        </div>
    </div>

    <div class="form-group">
        <label class="col-xs-12 col-sm-3 col-md-1 control-label">次数/时间:</label>
        <div class="col-sm-7 col-lg-8 col-md-8 col-xs-12">
            <input class="form-control" name="number" placeholder="激励视频填写次数/试玩小程序填写时间(单位秒)" value="{$task['number']}" type="text">
        </div>
    </div>
    <div class="form-group">
        <label class="col-xs-12 col-sm-3 col-md-1 control-label">奖励金币:</label>
        <div class="col-sm-7 col-lg-8 col-md-8 col-xs-12">
            <input class="form-control" name="currency" placeholder="奖励金币" value="{$task['currency']}" type="text">
        </div>
    </div>


<!--
    <div class="form-group">
        <label class="col-xs-12 col-sm-3 col-md-1 control-label">位置</label>
        <div class="col-sm-9 col-xs-12">
            <label class="radio-inline">
                <input type="radio" name="position" value="1" {if $task['position'] ==1 || $task['position'] == ''} checked {/if} /> 首页上方悬浮
            </label>
            <label class="radio-inline">
                <input type="radio" name="position" value="2"  {if $task['position'] ==2} checked {/if}  />天天领粮食
            </label>
        </div>
    </div>
-->

    <div class="form-group">
        <label class="col-xs-12 col-sm-3 col-md-1 control-label">顺序:</label>
        <div class="col-sm-7 col-lg-8 col-md-8 col-xs-12">
            <input class="form-control" name="sort" placeholder="顺序" value="{$task['sort']}" type="text">
        </div>
    </div>
    <div class="form-group">
        <label class="col-xs-12 col-sm-3 col-md-1 control-label"></label>
        <div class="">
            <input type="hidden" name="op" value="{php echo $id ? 'edit' : 'add'}">
            <input type="hidden" name="id" value="{$id}">
            <input type="submit" name="submit" id="submit" value="{php echo $id ? '修改' : '新增'}" class="btn btn-primary">
        </div>
    </div>
</form>
{template 'footer'}
<script>
    $(function () {
        $("input[name='type']").click(function () {
            if ($(this).val() == 2) {
                $('#mode_one').show();
                $("input[name='position']").attr('onClick',"javascript:return true");
            } else {
                $('#mode_one').hide();
                $("input[name='position']").attr('onClick',"javascript:return false");
            }
        });
    })
</script>